<%@ page language="java" contentType="text/html; charset=UTF-8"	 pageEncoding="UTF-8"%>
<%@ include file="../include/laypublic.jsp"%>
<!DOCTYPE html>
<html>
<head>
  <title>立项新增</title>
</head>
<style>
	.fieldset{
		margin-top: 5px;
		margin-bottom: 0px
	}
	.layui-legend{
		background-color:#5fb878;
		font-size:15px !important;
		width:140px;
	}
	.layui-form-item {
	    margin-bottom: 5px;
	    clear: both;
	    *zoom: 1;
	}
	.layui-form-label{width: 180px;}
	.right{
		float:right;
	}
	.width106{
		width:106px;
	}
	.width98{
		width:98px;
	}
	.width60{
		width:60px;
	}
</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
	    <div class="layui-tab-item layui-show">
	    	<div style="padding-top:15px;">&nbsp;</div>
			<form class="layui-form" id="addInfo_form" lay-filter="add_info_from">
				<fieldset class="layui-elem-field layui-field-title fieldset"  id="baseInfo">
				  <legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">项目基础信息  ></legend>
				  <div style="margin-top:20px">
				  	<div class="layui-form-item">
				  		<div class="layui-inline">
					      	<label class="layui-form-label">项目名称</label>
					      	<div class="layui-input-inline" style="width: 250px">
								<input type="hidden" name="id" value="${setupPro.id}">
								<input type="text" name="proName" value="${setupPro.proName}"  readonly maxlength="100" lay-verify="required" autocomplete="off" class="layui-input">
					      	</div>
					    </div>
					    <div class="layui-inline">
					    	<label class="layui-form-label">项目类型</label>
				      		<div class="layui-input-inline" style="width: 250px">
								<select name="types">
									<option value="1" <c:if test="${setupPro.types=='1'}">selected="selected"</c:if>>PPP项目</option>
									<option value="2"  <c:if test="${setupPro.types=='2'}">selected="selected"</c:if>>EPC项目</option>
								</select>
				      		</div>
					    </div>
					    <%--<div class="layui-inline">
					      	<label class="layui-form-label">项目编号</label>
					      	<div class="layui-input-inline" style="width: 250px">
					        	<input type="text" name="proCode"  value="${setupPro.proCode}" style="border:0px;" readonly="readonly" class="layui-input">
					      	</div>
					    </div>--%>
				    </div>
				  	<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">项目城市</label>
							<div class="layui-input-inline" style="width: 250px">
								<input type="hidden" name="sgCityId" value="${setupPro.sgCityId}" >
								<input name="sgCityName" value="${setupPro.sgCityName}" style="border:0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				  		<%--<div class="layui-inline">
					      	<label class="layui-form-label">申请公司</label>
					      	<div class="layui-input-inline" style="width: 250px">
								<input type="hidden" name="hrOrgId" value="${setupPro.hrOrgId!=null?setupPro.hrOrgId:bindOrgId}">
								<input type="text" value="${setupPro.orgName!=null?setupPro.orgName:bindOrgName}" style="border:0px;" readonly="readonly" class="layui-input">
					      	</div>
					    </div>--%>
					    <div class="layui-inline">
					    	<label class="layui-form-label">申请部门</label>
				      		<div class="layui-input-inline" style="width: 250px">
								<input type="hidden" name="hrDeptId" value="${setupPro.hrDeptId!=null?setupPro.hrDeptId:bindDeptId}">
								<input type="text" value="${setupPro.deptName!=null?setupPro.deptName:bindDeptName}" style="border:0px;" readonly="readonly" class="layui-input">
				      		</div>
					    </div>
					    <%--<div class="layui-inline">
					    	<label class="layui-form-label">申请人</label>
				      		<div class="layui-input-inline" style="width: 250px">
								<input type="hidden" name="hrStaffApplyId" value="${setupPro.hrStaffApplyId!=null?setupPro.hrStaffApplyId:SESSION_KEY_USER_DETAIL.hrStaffId }">
								<input type="text" name="staffName" value="${setupPro.staffName!=null?setupPro.staffName:SESSION_KEY_USER_DETAIL.realName }" readonly="readonly" style="border:0px" autocomplete="off" class="layui-input">
				      		</div>
					    </div>--%>
				    </div>
				  	<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">入库情况</label>
							<div class="layui-input-inline" style="width: 250px">
								<select name="isInStore" >
									<option value="">请选择-入库情况</option>
									<option value="0" <c:if test="${setupPro.isInStore=='0'}"> selected="selected"</c:if> >未入库</option>
									<option value="1" <c:if test="${setupPro.isInStore=='1'}"> selected="selected"</c:if> >已入库</option>
								</select>
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">营销经理</label>
							<div class="layui-input-inline" style="width: 250px">
								<input type="hidden" name="hrStaffMktId" value="${setupPro.hrStaffMktId}">
								<input type="text" name="hrStaffName" value="${setupPro.hrStaffName}"  readonly="readonly" style="border:0px" class="layui-input">
							</div>
						</div>

					    <%--<div class="layui-inline">
					    	<label class="layui-form-label">一般公共预算收入（亿元）</label>
				      		<div class="layui-input-inline">
					        	<input type="text" name="pubIncome" readonly="readonly" style="border:0px" class="layui-input">
					       	</div>
					    </div>
				  		<div class="layui-inline">
					      	<label class="layui-form-label">年度PPP项目占一般公共预算支出比例比(%)</label>
					      	<div class="layui-input-inline">
					        	<input type="text" name="pppPercent" readonly="readonly" style="border:0px" class="layui-input">
					      	</div>
					    </div>--%>
				    </div>
				  	<div class="layui-form-item">


		    		</div>
				  	<div class="layui-form-item">
				  		<div class="layui-inline">
					      	<label class="layui-form-label">项目简介</label>
					      	<div class="layui-input-inline">
					        	<textarea name="proRemarks"  maxlength="500" placeholder="请输入项目简介" class="layui-textarea" style="width:899px;height:90px;">${setupPro.proRemarks}</textarea>
					      	</div>
			    		</div>
		    		</div>
		  		</div>
			</fieldset>
			<fieldset class="layui-elem-field layui-field-title fieldset"  id="careerInfo">
		  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">项目合作方  ></legend>
			  	<div style="margin-top:20px">
			  		<div class="layui-form-item">
					    <div class="layui-inline">
					    	<label class="layui-form-label">项目渠道</label>
				      		<div class="layui-input-inline">
								<select name="fromChannel"  lay-filter="add_selectFromChannel" >
									<option value="">请选择-项目渠道</option>
									<option value="1" <c:if test="${setupPro.fromChannel=='1'}"> selected="selected"</c:if>>自行获取</option>
									<option value="2" <c:if test="${setupPro.fromChannel=='2'}"> selected="selected"</c:if>>居间合作</option>
								</select>
				      		</div>
					    </div>
					    <div class="layui-inline">
					    	<label class="layui-form-label">实施机构</label>
				      		<div class="layui-input-inline">
								<input type="text" name="carryOrg" value="${setupPro.carryOrg}" maxlength="100"  autocomplete="off" class="layui-input">
				      		</div>
					    </div>
					    <div class="layui-inline">
					    	<label class="layui-form-label">招标代理机构</label>
				      		<div class="layui-input-inline">
								<input type="text" name="bidAgent" value="${setupPro.bidAgent}"  maxlength="100"  autocomplete="off" class="layui-input">
				      		</div>
					    </div>
				    </div>
				    <div class="layui-form-item">
				    	<div class="layui-inline">
					    	<label class="layui-form-label">预计居间人费用（万元）</label>
				      		<div class="layui-input-inline">
					      		<input type="text" name="linkPowerCost" value="${setupPro.linkPowerCost}" lay-verify="required|floatAmount" placeholder="请输入" maxlength="11" autocomplete="off" onblur="isNumberAndFloat1(this);arabiaToCN(this,2);" class="layui-input">
				      		</div>
					    </div>
					    <div class="layui-inline">
					    	<label class="layui-form-label">占建安费用比例（%）</label>
				      		<div class="layui-input-inline">
					      		<input type="text" name="ofCaePercent" value="${setupPro.ofCaePercent}" lay-verify="required|floatNumber" placeholder="请输入" maxlength="11" autocomplete="off" onblur="isNumberAndFloat1(this);" class="layui-input">
				      		</div>
					    </div>
					    <div class="layui-inline" id="linkPowerDiv" style="display:none">
					    	<label class="layui-form-label">居间方</label>
				      		<div class="layui-input-inline">
					      		<input type="text" name="linkPower" value="${setupPro.linkPower}" id="linkPower" maxlength="100" autocomplete="off" class="layui-input">
				      		</div>
					    </div>
				    </div>
			  	</div>
			  	<fieldset class="layui-elem-field layui-field-title fieldset"  id="customerFile">
			  		<legend style="margin-left:40px;font-size:15px;font-weight:bold;">联合体单位  ></legend>
				  	<div style="margin-top:20px" id="coopDiv">
						<c:forEach items="${setupPro.setupProCoopVos }" var="coopVo" varStatus="status">
							<div class="layui-form-item" id="linkRow${status.index+1}">
								<div class="layui-inline width106">
									<p class="right">单位<label>${status.index+1}</label>：</p>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label width60">单位名称</label>
									<div class="layui-input-inline" <c:if test="${status.first}"> id="sgCoopSelect"</c:if> >
										<select name="sgCoopId" lay-search>
											<option value="">请选择-单位名称</option>
											<c:if test="${not empty coopInfos }">
												<c:forEach items="${coopInfos}" var="coop">
													<option value="${coop.id }" <c:if test="${coopVo.sgCoopId==coop.id}"> selected="selected"</c:if>>${coop.coopName }</option>
												</c:forEach>
											</c:if>
										</select>
									</div>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label">单位作用</label>
									<div class="layui-input-inline" <c:if test="${status.first}">id="coopEffectSelect"</c:if> >
										<select name="coopEffect">
											<option value="">请选择-单位作用</option>
											<option value="1" <c:if test="${coopVo.coopEffect=='1'}"> selected="selected"</c:if>>关系维护</option>
											<option value="2" <c:if test="${coopVo.coopEffect=='2'}"> selected="selected"</c:if>>资质补充</option>
											<option value="3" <c:if test="${coopVo.coopEffect=='3'}"> selected="selected"</c:if>>资金投入</option>
											<option value="4" <c:if test="${coopVo.coopEffect=='4'}"> selected="selected"</c:if>>运营合作</option>
										</select>
									</div>
								</div>
								<div class="layui-inline">
									<button type="button" class="layui-btn layui-btn-sm" id="addLinkBtn${status.index+1}" onclick="addRow(this);"><i class="layui-icon">&#xe654;</i></button>
									<c:if test="${not status.first}">
										<button type="button" class="layui-btn layui-btn-sm" id="delLinkBtn4" onclick="deleteRow(${status.index+1});"><i class="layui-icon">&#xe640;</i></button>
									</c:if>
								</div>
							</div>
						</c:forEach>
						<c:if test="${empty setupPro.setupProCoopVos }">
							<div class="layui-form-item" id="linkRow1">
								<div class="layui-inline width106">
									<p class="right">单位<label>1</label>：</p>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label width60">单位名称</label>
									<div class="layui-input-inline" id="sgCoopSelect">
										<select name="sgCoopId" lay-search>
											<option value="">请选择-单位名称</option>
											<c:if test="${not empty coopInfos }">
												<c:forEach items="${coopInfos}" var="coop">
													<option value="${coop.id }">${coop.coopName }</option>
												</c:forEach>
											</c:if>
										</select>
									</div>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label">单位作用</label>
									<div class="layui-input-inline" id="coopEffectSelect">
										<select name="coopEffect">
											<option value="">请选择-单位作用</option>
											<option value="1">关系维护</option>
											<option value="2">资质补充</option>
											<option value="3">资金投入</option>
											<option value="4">运营合作</option>
										</select>
									</div>
								</div>
								<div class="layui-inline">
									<button type="button" class="layui-btn layui-btn-sm" id="addLinkBtn1" onclick="addRow(this);"><i class="layui-icon">&#xe654;</i></button>
								</div>
							</div>
						</c:if>
					</div>
			  	</fieldset>
				</fieldset>
				<fieldset class="layui-elem-field layui-field-title fieldset" id="loanInfo">
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">项目子项  ></legend>
				  	<div style="margin-top:20px">
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">合作周期（年）</label>
					      		<div class="layui-input-inline">
									<input type="text" name="workYears" value="${setupPro.workYears!=null?setupPro.workYears:0}" readonly="readonly" style="border:0px" class="layui-input">
								</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">建设周期（年）</label>
						      	<div class="layui-input-inline">
						        	<input type="text" name="buildYears" value="${setupPro.buildYears!=null?setupPro.buildYears:0}"  readonly="readonly" style="border:0px" class="layui-input">
						      	</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">运营周期（年）</label>
						      	<div class="layui-input-inline">
									<input type="text" name="omYears" value="${setupPro.omYears!=null?setupPro.omYears:0}" readonly="readonly" style="border:0px" class="layui-input">
								</div>
						    </div>
					    </div>
					    <fieldset class="layui-elem-field layui-field-title fieldset"  id="customerFile">
					  		<legend style="margin-left:40px;font-size:15px;font-weight:bold;">项目子项  ></legend>
						  	<div style="margin-top:20px" id="subDiv">
								<c:forEach items="${setupPro.setupProSubs}" var="subs" varStatus="status">
									<div id="commRow${status.index+1}">
										<div class="layui-form-item">
											<div class="layui-inline width106">
												<p class="right">子项<label>${status.index+1}</label>：</p>
												<input type="hidden" name="orderIdx" value="${status.index+1}"/>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width60">子项名称</label>
												<div class="layui-input-inline" style="width:120px;">
													<input type="text" name="subName" value="${subs.subName}" maxlength="100"  autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">合作周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subWorkYears" value="${subs.workYears}" maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">建设周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subBuildYears" value="${subs.buildYears}" maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">运营周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subOmYears" value="${subs.omYears}" maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<button type="button" class="layui-btn layui-btn-sm" id="addCommBtn${status.index+1}" onclick="addCommRow(this)"><i class="layui-icon">&#xe654;</i></button>
												<c:if test="${not status.first}">
													<button type="button" class="layui-btn layui-btn-sm" id="delCommBtn${status.index+1}" onclick="deleteCommRow(${status.index+1})"><i class="layui-icon">&#xe640;</i></button>
												</c:if>
											</div>
										</div>
									</div>
								</c:forEach>
								<c:if test="${empty setupPro.setupProSubs}">
									<div id="commRow1">
										<div class="layui-form-item">
											<div class="layui-inline width106">
												<p class="right">子项<label>1</label>：</p>
												<input type="hidden" name="orderIdx" value="1"/>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width60">子项名称</label>
												<div class="layui-input-inline" style="width:120px;">
													<input type="text" name="subName" value="" maxlength="100"  autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">合作周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subWorkYears" value="" maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">建设周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subBuildYears" value="" maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">运营周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subOmYears" value="" maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<button type="button" class="layui-btn layui-btn-sm" id="addCommBtn1" onclick="addCommRow(this)"><i class="layui-icon">&#xe654;</i></button>
												<button type="button" class="layui-btn layui-btn-sm" style="display:none" id="delCommBtn1" onclick="deleteCommRow(1)"><i class="layui-icon">&#xe640;</i></button>
											</div>
										</div>
									</div>
								</c:if>
						  	</div>
						</fieldset>
					</div>
				</fieldset>
				<fieldset class="layui-elem-field layui-field-title fieldset" id="houseInfo">
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">项目资金信息  ></legend>
				  	<div style="margin-top:20px">
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">资本金数额（万元）</label>
					      		<div class="layui-input-inline">
									<input type="text" name="capitalFund" value="${setupPro.capitalFund}" lay-verify="required|floatAmount" placeholder="请输入" maxlength="11" autocomplete="off" onblur="isNumberAndFloat1(this);arabiaToCN(this,2);" class="layui-input">
					      		</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">资本金比例（%）</label>
						      	<div class="layui-input-inline">
						        	<input type="text" name="capitalPercent"  value="${setupPro.capitalPercent}" lay-verify="required|floatNumber" placeholder="请输入" maxlength="11" autocomplete="off" onblur="isNumberAndFloat1(this);" class="layui-input">
						      	</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">我方股权出资金额（万元）</label>
						      	<div class="layui-input-inline">
						        	<input type="text" name="stockFund" value="${setupPro.stockFund}" lay-verify="required|floatAmount" placeholder="请输入" maxlength="11" autocomplete="off" onblur="isNumberAndFloat1(this);arabiaToCN(this,2);" class="layui-input">
						      	</div>
						    </div>
					    </div>
					    <div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">我方股权比例（%）</label>
					      		<div class="layui-input-inline">
						      		<input type="text" name="stockPercent" value="${setupPro.stockPercent}" maxlength="11" lay-verify="required|floatNumber" placeholder="请输入" autocomplete="off" onblur="isNumberAndFloat1(this);" class="layui-input">
					      		</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">总投资额（万元）</label>
						      	<div class="layui-input-inline">
						        	<input type="text" name="sumAmount" value="${setupPro.sumAmount}" id="sumAmount" style="border:0px;" readonly="readonly" autocomplete="off" class="layui-input">
						      	</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">建安工程总费用（万元）</label>
						      	<div class="layui-input-inline">
						        	<input type="text" name="sumCae" value="${setupPro.sumCae}" id="sumCae" style="border:0px;" readonly="readonly" autocomplete="off" class="layui-input">
						      	</div>
						    </div>
					    </div>
					    <fieldset class="layui-elem-field layui-field-title fieldset"  id="creditInfo">
			  				<legend style="margin-left:40px;font-size:15px;font-weight:bold;">投资构成  ></legend>
				  			<div style="margin-top:20px">
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">建安工程费（万元）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="costCae"  value="${setupPro.costCae}" id="costCae" maxlength="11" lay-verify="required|floatAmount" onblur="calcSumAmount();arabiaToCN(this,2);" autocomplete="off" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								      	<label class="layui-form-label">设备购置工程费（万元）</label>
								      	<div class="layui-input-inline">
								        	<input type="text" name="deviceCost" value="${setupPro.deviceCost}" id="deviceCost" maxlength="11" lay-verify="required|floatAmount" onblur="calcSumAmount();arabiaToCN(this,2);" autocomplete="off" class="layui-input">
								      	</div>
								    </div>
								    <div class="layui-inline">
								      	<label class="layui-form-label">预备费（万元）</label>
								      	<div class="layui-input-inline">
								        	<input type="text" name="inReadyCost" value="${setupPro.inReadyCost}"  id="inReadyCost" maxlength="11" lay-verify="required|floatAmount" onblur="calcSumAmount();arabiaToCN(this,2);" autocomplete="off" class="layui-input">
								      	</div>
								    </div>
							    </div>
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">建设期利息（万元）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="periodInterest" value="${setupPro.periodInterest}" id="periodInterest" maxlength="11" lay-verify="required|floatAmount" onblur="calcSumAmount();arabiaToCN(this,2);" autocomplete="off" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								      	<label class="layui-form-label">铺底流动资金（万元）</label>
								      	<div class="layui-input-inline">
								        	<input type="text" name="fluidCapital" value="${setupPro.fluidCapital}"  id="fluidCapital" maxlength="11" lay-verify="required|floatAmount" onblur="calcSumAmount();arabiaToCN(this,2);" autocomplete="off" class="layui-input">
								      	</div>
								    </div>
								    <div class="layui-inline">
								      	<label class="layui-form-label">工程建设其他费（万元）</label>
								      	<div class="layui-input-inline">
								        	<input type="text" name="otherCost" value="${setupPro.otherCost}" id="otherCost" maxlength="11" lay-verify="required|floatAmount" onblur="calcSumAmount();arabiaToCN(this,2);" autocomplete="off" class="layui-input">
								      	</div>
								    </div>
							    </div>
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">其中：征地拆迁费（万元）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="moveOutCost" value="${setupPro.moveOutCost}"  maxlength="11" lay-verify="required|floatAmount" autocomplete="off" onblur="isNumberAndFloat1(this);arabiaToCN(this,2);" class="layui-input">
							      		</div>
								    </div>
							    </div>
				  			</div>
				  		</fieldset>
					    <fieldset class="layui-elem-field layui-field-title fieldset"  id="creditInfo">
			  				<legend style="margin-left:40px;font-size:15px;font-weight:bold;">回报机制 ></legend>
				  			<div style="margin-top:20px">
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">回报机制 &nbsp;&nbsp;</label>
										<div class="layui-input-inline">
											<input type="checkbox" name="backMech" value="1" <c:if test="${fn:contains(setupPro.backMech, '1')}"> checked="checked"</c:if> title="政府付费" lay-skin="primary">
										</div>
										<div class="layui-input-inline">
											<input type="checkbox" name="backMech" value="2" <c:if test="${fn:contains(setupPro.backMech, '2')}">checked="checked"</c:if> title="可行性缺口补助" lay-skin="primary">
										</div>
										<div class="layui-input-inline">
											<input type="checkbox" name="backMech" value="3" <c:if test="${fn:contains(setupPro.backMech, '3')}">checked="checked"</c:if> title="使用者付费" lay-skin="primary">
										</div>
								    </div>
							    </div>
								<label class="layui-form-label">回报指标 ></label>
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">工程费用下浮率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="downRate" value="${setupPro.downRate}" maxlength="11" lay-verify="required|floatNumber" autocomplete="off" onblur="isNumberAndFloat1(this);" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								    	<label class="layui-form-label">折现率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="discountRate" value="${setupPro.discountRate}" maxlength="11" lay-verify="required|floatNumber" autocomplete="off" onblur="isNumberAndFloat1(this);" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								    	<label class="layui-form-label">合理利润率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="profitRate" value="${setupPro.profitRate}" maxlength="11" lay-verify="required|floatNumber" autocomplete="off" onblur="isNumberAndFloat1(this);" class="layui-input">
							      		</div>
								    </div>
							    </div>
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">建设期融资利率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="finRate"  value="${setupPro.finRate}" maxlength="11" lay-verify="required|floatNumber" autocomplete="off" onblur="isNumberAndFloat1(this);" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								    	<label class="layui-form-label">资本金回报率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="capitalBackRate" value="${setupPro.capitalBackRate}" maxlength="11" lay-verify="required|floatNumber" autocomplete="off" onblur="isNumberAndFloat1(this);" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								    	<label class="layui-form-label">融资回报率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="finBackRate" value="${setupPro.finBackRate}" maxlength="11" lay-verify="required|floatNumber" autocomplete="off" onblur="isNumberAndFloat1(this);" class="layui-input">
							      		</div>
								    </div>
							    </div>
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">投资回报率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="investBackRate" value="${setupPro.investBackRate}" maxlength="11" lay-verify="required|floatNumber" autocomplete="off" onblur="isNumberAndFloat1(this);" class="layui-input">
							      		</div>
								    </div>
							    </div>
				  			</div>
				  		</fieldset>
				  	</div>
				</fieldset>
				<fieldset class="layui-elem-field layui-field-title fieldset"  id="creditInfo">
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">项目其他信息  ></legend>
				  	<div style="margin-top:20px">
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">项目风险（选填）</label>
					      		<div class="layui-input-inline">
						      		<textarea name="proRisk" maxlength="500" placeholder="请输入项目风险" class="layui-textarea" style="width:899px;height:90px;">${setupPro.proRisk}</textarea>
					      		</div>
						    </div>
					    </div>
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">项目优点（选填）</label>
					      		<div class="layui-input-inline">
						      		<textarea name="proMerit"  maxlength="500" placeholder="请输入项目优点" class="layui-textarea" style="width:899px;height:90px;">${setupPro.proMerit}</textarea>
					      		</div>
						    </div>
					    </div>
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">其他说明（选填）</label>
					      		<div class="layui-input-inline">
						      		<textarea name="proOthers" maxlength="500" placeholder="请输入其他说明" class="layui-textarea" style="width:899px;height:90px;">${setupPro.proOthers}</textarea>
					      		</div>
						    </div>
					    </div>
				  	</div>
				</fieldset>
				<fieldset class="layui-elem-field layui-field-title fieldset" >
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">附件信息  ></legend>
					  	<div style="margin-top:20px;">
						    <div class="layui-form-item">
							    <label class="layui-form-label" style="width:350px;">支持pdf、excel、word、图片资料，可上传多个</label>
							</div>
						    <div class="layui-form-item">
							    <label class="layui-form-label">立项申请建议书</label>
							    <div class="layui-input-block">
							    	<div class="layui-upload">
						              	<button type="button" class="layui-btn" id="11-upload-more">上传</button>
				                		<div class="layui-upload-list" id="11-upload-more-list">
											<c:forEach items="${setupPro.setupProAtts }" var="fileAtt">
												<c:if test="${fileAtt.types == '11' }">
													<div class="layui-upload-img-div" id="upload_img_${fileAtt.id}">
														<c:choose>
															<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
																<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:when>
															<c:otherwise>
																<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:otherwise>
														</c:choose>
														<div class="mask">
															<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
															<a href="javascript:void(0)" onclick="del('${fileAtt.id}')" >删除</a>
														</div>
														<p>${fileAtt.fileName}</p>
														<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix}|${fileAtt.id}|${fileAtt.filePath} " id="fileAtt_${fileAtt.id}" name="fileAtt11" />
													</div>
												</c:if>
											</c:forEach>
				                		</div>
						            </div>
							    </div>
						  	</div>
						    <div class="layui-form-item">
							    <label class="layui-form-label">项目财政承受可行性评估</label>
							    <div class="layui-input-block">
							    	<div class="layui-upload">
						              	<button type="button" class="layui-btn" id="12-upload-more">上传</button>
				                		<div class="layui-upload-list" id="12-upload-more-list">
											<c:forEach items="${setupPro.setupProAtts }" var="fileAtt">
												<c:if test="${fileAtt.types == '12' }">
													<div class="layui-upload-img-div" id="upload_img_${fileAtt.id}">
														<c:choose>
															<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
																<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:when>
															<c:otherwise>
																<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:otherwise>
														</c:choose>
														<div class="mask">
															<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
															<a href="javascript:void(0)" onclick="del('${fileAtt.id}')" >删除</a>
														</div>
														<p>${fileAtt.fileName}</p>
														<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix}|${fileAtt.id}|${fileAtt.filePath} " id="fileAtt_${fileAtt.id}" name="fileAtt12" />
													</div>
												</c:if>
											</c:forEach>
				                		</div>
						            </div>
							    </div>
						  	</div>
						    <div class="layui-form-item">
							    <label class="layui-form-label">项目物有所值评估</label>
							    <div class="layui-input-block">
							    	<div class="layui-upload">
						              	<button type="button" class="layui-btn" id="13-upload-more">上传</button>
				                		<div class="layui-upload-list" id="13-upload-more-list">
											<c:forEach items="${setupPro.setupProAtts }" var="fileAtt">
												<c:if test="${fileAtt.types == '13' }">
													<div class="layui-upload-img-div" id="upload_img_${fileAtt.id}">
														<c:choose>
															<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
																<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:when>
															<c:otherwise>
																<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:otherwise>
														</c:choose>
														<div class="mask">
															<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
															<a href="javascript:void(0)" onclick="del('${fileAtt.id}')" >删除</a>
														</div>
														<p>${fileAtt.fileName}</p>
														<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix}|${fileAtt.id}|${fileAtt.filePath} " id="fileAtt_${fileAtt.id}" name="fileAtt13" />
													</div>
												</c:if>
											</c:forEach>
				                		</div>
						            </div>
							    </div>
						  	</div>
						    <div class="layui-form-item">
							    <label class="layui-form-label">营销策划书（选填）</label>
							    <div class="layui-input-block">
							    	<div class="layui-upload">
						              	<button type="button" class="layui-btn" id="14-upload-more">上传</button>
				                		<div class="layui-upload-list" id="14-upload-more-list">
											<c:forEach items="${setupPro.setupProAtts }" var="fileAtt">
												<c:if test="${fileAtt.types == '14' }">
													<div class="layui-upload-img-div" id="upload_img_${fileAtt.id}">
														<c:choose>
															<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
																<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:when>
															<c:otherwise>
																<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:otherwise>
														</c:choose>
														<div class="mask">
															<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
															<a href="javascript:void(0)" onclick="del('${fileAtt.id}')" >删除</a>
														</div>
														<p>${fileAtt.fileName}</p>
														<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix}|${fileAtt.id}|${fileAtt.filePath} " id="fileAtt_${fileAtt.id}" name="fileAtt14" />
													</div>
												</c:if>
											</c:forEach>
				                		</div>
						            </div>
							    </div>
						  	</div>
						    <div class="layui-form-item">
							    <label class="layui-form-label">项目实施方案（选填）</label>
							    <div class="layui-input-block">
							    	<div class="layui-upload">
						              	<button type="button" class="layui-btn" id="15-upload-more">上传</button>
				                		<div class="layui-upload-list" id="15-upload-more-list">
											<c:forEach items="${setupPro.setupProAtts }" var="fileAtt">
												<c:if test="${fileAtt.types == '15' }">
													<div class="layui-upload-img-div" id="upload_img_${fileAtt.id}">
														<c:choose>
															<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
																<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:when>
															<c:otherwise>
																<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:otherwise>
														</c:choose>
														<div class="mask">
															<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
															<a href="javascript:void(0)" onclick="del('${fileAtt.id}')" >删除</a>
														</div>
														<p>${fileAtt.fileName}</p>
														<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix}|${fileAtt.id}|${fileAtt.filePath} " id="fileAtt_${fileAtt.id}" name="fileAtt15" />
													</div>
												</c:if>
											</c:forEach>
				                		</div>
						            </div>
							    </div>
						  	</div>
						    <div class="layui-form-item">
							    <label class="layui-form-label">营销经理责任书（选填）</label>
							    <div class="layui-input-block">
							    	<div class="layui-upload">
						              	<button type="button" class="layui-btn" id="16-upload-more">上传</button>
				                		<div class="layui-upload-list" id="16-upload-more-list">
											<c:forEach items="${setupPro.setupProAtts }" var="fileAtt">
												<c:if test="${fileAtt.types == '16' }">
													<div class="layui-upload-img-div" id="upload_img_${fileAtt.id}">
														<c:choose>
															<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
																<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:when>
															<c:otherwise>
																<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:otherwise>
														</c:choose>
														<div class="mask">
															<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
															<a href="javascript:void(0)" onclick="del('${fileAtt.id}')" >删除</a>
														</div>
														<p>${fileAtt.fileName}</p>
														<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix}|${fileAtt.id}|${fileAtt.filePath} " id="fileAtt_${fileAtt.id}" name="fileAtt16" />
													</div>
												</c:if>
											</c:forEach>
				                		</div>
						            </div>
							    </div>
						  	</div>
						    <div class="layui-form-item">
							    <label class="layui-form-label">其他资料（选填）</label>
							    <div class="layui-input-block">
							    	<div class="layui-upload">
						              	<button type="button" class="layui-btn" id="19-upload-more">上传</button>
				                		<div class="layui-upload-list" id="19-upload-more-list">
											<c:forEach items="${setupPro.setupProAtts }" var="fileAtt">
												<c:if test="${fileAtt.types == '19' }">
													<div class="layui-upload-img-div" id="upload_img_${fileAtt.id}">
														<c:choose>
															<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
																<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:when>
															<c:otherwise>
																<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
															</c:otherwise>
														</c:choose>
														<div class="mask">
															<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
															<a href="javascript:void(0)" onclick="del('${fileAtt.id}')" >删除</a>
														</div>
														<p>${fileAtt.fileName}</p>
														<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix}|${fileAtt.id}|${fileAtt.filePath} " id="fileAtt_${fileAtt.id}" name="fileAtt19" />
													</div>
												</c:if>
											</c:forEach>
				                		</div>
						            </div>
							    </div>
						  	</div>
					  	</div>
				</fieldset>
				<div class="layui-form-item" style="position: fixed ! important; right: 30px;  top:4%;z-index:10000;">
					<div class="layui-input-block">
			      		<%--<button class="layui-btn layui-bg-blue layui-btn-normal layui-btn-lg  layui-btn-radius" type="button" lay-submit lay-filter="addInfo_form_submit" id="addInfo_form_submit">
			      		<i class="layui-icon layui-icon-ok layuiadmin-button-btn"></i>
			      		提交
			      		</button>--%>
							<input type="hidden" name="submitType" id="submitType">
							<button type="button" type="button" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="addInfo_form_submit" id="addInfo_form_submit2">保存</button>
							<c:if test="${edit=='edit'}">
								<button type="button" type="button" class="layui-btn layui-btn-radius" lay-submit lay-filter="addInfo_form_submit" id="addInfo_form_submit">提交</button>
							</c:if>
			      	</div>
			    </div>
			</form>
  		</div>
	</div>
</div>
  <script>
	//静态资源路径前缀
	var staticPath = '${fileHttpPre}';
	var stateJSON = <infopub:dicJson groupNo="A00010028" />;

  layui.config({
    base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'set', 'upload', 'element', 'laydate'], function(){
    var $ = layui.$
    ,form = layui.form
    ,element = layui.element
    ,laydate = layui.laydate
    ,upload = layui.upload;

 	// 正则校验
	form.verify({
		//验证汉字
	    CHS:[
	    	/^[\u0391-\uFFE5]+$/
	    	,'只能输入汉字'
	  	],
	  	//大于0的正整数
	  	intNumber:[
			/^[1-9]\d*$/
			,'请输入正确的数字'
	  	],
	  	//数字只能有两位小数
	  	floatNumber:[
			/^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
			,'请输入正确的数字'
	  	],
	  	//数字大于等于0，并只能有两位小数
	  	floatAmount:[
			/^([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
			//var pattern=/^((\d+\.\d*[1-9]\d{1})|(\d*[1-9]\d*\.\d{2}))$/;
			,'请输入正确的数字'
	  	]
	});

	//立项申请建议书
  	upload.render({
	      elem: '#11-upload-more'
	      ,url: basePath + '/setupPro/uploadAtt/'
	      ,data: {
	    	  types:11
	    		}
	      ,multiple: true
	      ,accept: 'file'
	      ,acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf'
	   	  ,before: function(obj){ //obj参数包含的信息
	   		    layer.load(); //上传loading
	   		  }
	      ,done: function(res){
	    	  //如果上传失败
	          if(res.code > 0){
	        	  layer.closeAll('loading'); //关闭loading
	        	  return layer.msg(res.msg,{icon: 7});
	          }
	          //上传完毕
	   	  	  if(res.entity != null && res.entity.length > 0){
				for(var i in res.entity){
					var setupPro = res.entity[i];
					var arr = setupPro.split("|");
					var imgSrc = "";
					var suffix = arr[1].substring(arr[1].lastIndexOf(".")+1,arr[1].length);
					if(suffix == 'jpg' || suffix == 'png'){
						imgSrc = "${fileHttpPre}/"+arr[3];
					}else{
						imgSrc = "${ctx}/resources/images/"+suffix+".jpg";
					}
	        		$('#11-upload-more-list').append('<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''+"${fileHttpPre}"+arr[3] +'\');">查看</a><a href="javascript:void(0)" onclick="del(\''+arr[2]+'\')";>删除</a></div><p>'+arr[1]+'</p><input type="hidden" value="'+setupPro+'" id="fileAtt_'+arr[2]+'" name="fileAtt11" ></input></div> ');
				}
		  	  }
	      }
	      ,allDone: function(obj){ //当文件全部被提交后，才触发
	    	  layer.closeAll('loading'); //关闭loading
	      }
	      ,error: function(){
	    	  layer.closeAll('loading'); //关闭loading
	          //上传失败
	          layer.msg("上传失败，请稍后再试~",{icon: 7});
	        }
	    });

	//项目财政承受可行性评估
  	upload.render({
	      elem: '#12-upload-more'
	      ,url: basePath + '/setupPro/uploadAtt/'
	      ,data: {
	    	  types:12
	    		}
	      ,multiple: true
	      ,accept: 'file'
	      ,acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf'
	   	  ,before: function(obj){ //obj参数包含的信息
	   		    layer.load(); //上传loading
	   		  }
	      ,done: function(res){
	    	  //如果上传失败
	          if(res.code > 0){
	        	  layer.closeAll('loading'); //关闭loading
	        	  return layer.msg(res.msg,{icon: 7});
	          }
	          //上传完毕
	   	  	  if(res.entity != null && res.entity.length > 0){
				for(var i in res.entity){
					var fileAtt = res.entity[i];
					var arr = fileAtt.split("|");
					var imgSrc = "";
					var suffix = arr[1].substring(arr[1].lastIndexOf(".")+1,arr[1].length);
					if(suffix == 'jpg' || suffix == 'png'){
						imgSrc = "${fileHttpPre}/"+arr[3];
					}else{
						imgSrc = "${ctx}/resources/images/"+suffix+".jpg";
					}
	        		$('#12-upload-more-list').append('<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''+"${fileHttpPre}"+arr[3] +'\');">查看</a><a href="javascript:void(0)" onclick="del(\''+arr[2]+'\')";>删除</a></div><p>'+arr[1]+'</p><input type="hidden" value="'+fileAtt+'" id="fileAtt_'+arr[2]+'" name="fileAtt12" ></input></div> ');
				}
		  	  }
	      }
	      ,allDone: function(obj){ //当文件全部被提交后，才触发
	    	  layer.closeAll('loading'); //关闭loading
	      }
	      ,error: function(){
	    	  layer.closeAll('loading'); //关闭loading
	          //上传失败
	          layer.msg("上传失败，请稍后再试~",{icon: 7});
	        }
	    });

	//项目物有所值评估
  	upload.render({
	      elem: '#13-upload-more'
	      ,url: basePath + '/setupPro/uploadAtt/'
	      ,data: {
	    	  types:13
	    		}
	      ,multiple: true
	      ,accept: 'file'
	      ,acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf'
	   	  ,before: function(obj){ //obj参数包含的信息
	   		    layer.load(); //上传loading
	   		  }
	      ,done: function(res){
	    	  //如果上传失败
	          if(res.code > 0){
	        	  layer.closeAll('loading'); //关闭loading
	        	  return layer.msg(res.msg,{icon: 7});
	          }
	          //上传完毕
	   	  	  if(res.entity != null && res.entity.length > 0){
				for(var i in res.entity){
					var fileAtt = res.entity[i];
					var arr = fileAtt.split("|");
					var imgSrc = "";
					var suffix = arr[1].substring(arr[1].lastIndexOf(".")+1,arr[1].length);
					if(suffix == 'jpg' || suffix == 'png'){
						imgSrc = "${fileHttpPre}/"+arr[3];
					}else{
						imgSrc = "${ctx}/resources/images/"+suffix+".jpg";
					}
	        		$('#13-upload-more-list').append('<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''+"${fileHttpPre}"+arr[3] +'\');">查看</a><a href="javascript:void(0)" onclick="del(\''+arr[2]+'\')";>删除</a></div><p>'+arr[1]+'</p><input type="hidden" value="'+fileAtt+'" id="fileAtt_'+arr[2]+'" name="fileAtt13" ></input></div> ');
				}
		  	  }
	      }
	      ,allDone: function(obj){ //当文件全部被提交后，才触发
	    	  layer.closeAll('loading'); //关闭loading
	      }
	      ,error: function(){
	    	  layer.closeAll('loading'); //关闭loading
	          //上传失败
	          layer.msg("上传失败，请稍后再试~",{icon: 7});
	        }
	    });

	//营销策划书（选填）
  	upload.render({
	      elem: '#14-upload-more'
	      ,url: basePath + '/setupPro/uploadAtt/'
	      ,data: {
	    	  types:14
	    		}
	      ,multiple: true
	      ,accept: 'file'
	      ,acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf'
	   	  ,before: function(obj){ //obj参数包含的信息
	   		    layer.load(); //上传loading
	   		  }
	      ,done: function(res){
	    	  //如果上传失败
	          if(res.code > 0){
	        	  layer.closeAll('loading'); //关闭loading
	        	  return layer.msg(res.msg,{icon: 7});
	          }
	          //上传完毕
	   	  	  if(res.entity != null && res.entity.length > 0){
				for(var i in res.entity){
					var fileAtt = res.entity[i];
					var arr = fileAtt.split("|");
					var imgSrc = "";
					var suffix = arr[1].substring(arr[1].lastIndexOf(".")+1,arr[1].length);
					if(suffix == 'jpg' || suffix == 'png'){
						imgSrc = "${fileHttpPre}/"+arr[3];
					}else{
						imgSrc = "${ctx}/resources/images/"+suffix+".jpg";
					}
	        		$('#14-upload-more-list').append('<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''+"${fileHttpPre}"+arr[3] +'\');">查看</a><a href="javascript:void(0)" onclick="del(\''+arr[2]+'\')";>删除</a></div><p>'+arr[1]+'</p><input type="hidden" value="'+fileAtt+'" id="fileAtt_'+arr[2]+'" name="fileAtt14" ></input></div> ');
				}
		  	  }
	      }
	      ,allDone: function(obj){ //当文件全部被提交后，才触发
	    	  layer.closeAll('loading'); //关闭loading
	      }
	      ,error: function(){
	    	  layer.closeAll('loading'); //关闭loading
	          //上传失败
	          layer.msg("上传失败，请稍后再试~",{icon: 7});
	        }
	    });

	//项目实施方案（选填）
  	upload.render({
	      elem: '#15-upload-more'
	      ,url: basePath + '/setupPro/uploadAtt/'
	      ,data: {
	    	  types:15
	    		}
	      ,multiple: true
	      ,accept: 'file'
	      ,acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf'
	   	  ,before: function(obj){ //obj参数包含的信息
	   		    layer.load(); //上传loading
	   		  }
	      ,done: function(res){
	    	  //如果上传失败
	          if(res.code > 0){
	        	  layer.closeAll('loading'); //关闭loading
	        	  return layer.msg(res.msg,{icon: 7});
	          }
	          //上传完毕
	   	  	  if(res.entity != null && res.entity.length > 0){
				for(var i in res.entity){
					var fileAtt = res.entity[i];
					var arr = fileAtt.split("|");
					var imgSrc = "";
					var suffix = arr[1].substring(arr[1].lastIndexOf(".")+1,arr[1].length);
					if(suffix == 'jpg' || suffix == 'png'){
						imgSrc = "${fileHttpPre}/"+arr[3];
					}else{
						imgSrc = "${ctx}/resources/images/"+suffix+".jpg";
					}
	        		$('#15-upload-more-list').append('<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''+"${fileHttpPre}"+arr[3] +'\');">查看</a><a href="javascript:void(0)" onclick="del(\''+arr[2]+'\')";>删除</a></div><p>'+arr[1]+'</p><input type="hidden" value="'+fileAtt+'" id="fileAtt_'+arr[2]+'" name="fileAtt15" ></input></div> ');
				}
		  	  }
	      }
	      ,allDone: function(obj){ //当文件全部被提交后，才触发
	    	  layer.closeAll('loading'); //关闭loading
	      }
	      ,error: function(){
	    	  layer.closeAll('loading'); //关闭loading
	          //上传失败
	          layer.msg("上传失败，请稍后再试~",{icon: 7});
	        }
	    });

	//营销经理责任书（选填）
  	upload.render({
	      elem: '#16-upload-more'
	      ,url: basePath + '/setupPro/uploadAtt/'
	      ,data: {
	    	  types:16
	    		}
	      ,multiple: true
	      ,accept: 'file'
	      ,acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf'
	   	  ,before: function(obj){ //obj参数包含的信息
	   		    layer.load(); //上传loading
	   		  }
	      ,done: function(res){
	    	  //如果上传失败
	          if(res.code > 0){
	        	  layer.closeAll('loading'); //关闭loading
	        	  return layer.msg(res.msg,{icon: 7});
	          }
	          //上传完毕
	   	  	  if(res.entity != null && res.entity.length > 0){
				for(var i in res.entity){
					var fileAtt = res.entity[i];
					var arr = fileAtt.split("|");
					var imgSrc = "";
					var suffix = arr[1].substring(arr[1].lastIndexOf(".")+1,arr[1].length);
					if(suffix == 'jpg' || suffix == 'png'){
						imgSrc = "${fileHttpPre}/"+arr[3];
					}else{
						imgSrc = "${ctx}/resources/images/"+suffix+".jpg";
					}
	        		$('#16-upload-more-list').append('<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''+"${fileHttpPre}"+arr[3] +'\');">查看</a><a href="javascript:void(0)" onclick="del(\''+arr[2]+'\')";>删除</a></div><p>'+arr[1]+'</p><input type="hidden" value="'+fileAtt+'" id="fileAtt_'+arr[2]+'" name="fileAtt16" ></input></div> ');
				}
		  	  }
	      }
	      ,allDone: function(obj){ //当文件全部被提交后，才触发
	    	  layer.closeAll('loading'); //关闭loading
	      }
	      ,error: function(){
	    	  layer.closeAll('loading'); //关闭loading
	          //上传失败
	          layer.msg("上传失败，请稍后再试~",{icon: 7});
	        }
	    });

	//其他资料
  	upload.render({
	      elem: '#19-upload-more'
	      ,url: basePath + '/setupPro/uploadAtt/'
	      ,data: {
	    	  types:19
	    		}
	      ,multiple: true
	      ,accept: 'file'
	      ,acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf'
	   	  ,before: function(obj){ //obj参数包含的信息
	   		    layer.load(); //上传loading
	   		  }
	      ,done: function(res){
	    	  //如果上传失败
	          if(res.code > 0){
	        	  layer.closeAll('loading'); //关闭loading
	        	  return layer.msg(res.msg,{icon: 7});
	          }
	          //上传完毕
	   	  	  if(res.entity != null && res.entity.length > 0){
				for(var i in res.entity){
					var fileAtt = res.entity[i];
					var arr = fileAtt.split("|");
					var imgSrc = "";
					var suffix = arr[1].substring(arr[1].lastIndexOf(".")+1,arr[1].length);
					if(suffix == 'jpg' || suffix == 'png'){
						imgSrc = "${fileHttpPre}/"+arr[3];
					}else{
						imgSrc = "${ctx}/resources/images/"+suffix+".jpg";
					}
	        		$('#19-upload-more-list').append('<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''+"${fileHttpPre}"+arr[3] +'\');">查看</a><a href="javascript:void(0)" onclick="del(\''+arr[2]+'\')";>删除</a></div><p>'+arr[1]+'</p><input type="hidden" value="'+fileAtt+'" id="fileAtt_'+arr[2]+'" name="fileAtt19" ></input></div> ');
				}
		  	  }
	      }
	      ,allDone: function(obj){ //当文件全部被提交后，才触发
	    	  layer.closeAll('loading'); //关闭loading
	      }
	      ,error: function(){
	    	  layer.closeAll('loading'); //关闭loading
	          //上传失败
	          layer.msg("上传失败，请稍后再试~",{icon: 7});
	        }
	    });


  	//项目名称select监听
    form.on('select(add_select_preProId)', function(data){
    	var id = data.value;
    	if(id == null || id == ''){
    		return;
    	}
    	//获取公司下的所有部门
		$.ajax({
			type : "POST", //提交方式
			url : "${ctx}/preProject/getPreProjectById",//路径
			data : {
				"id" :id
			},//数据，这里使用的是Json格式进行传输
			success : function(result) {//返回数据根据结果进行相应的处理
				if(result.flag==true){
					form.val('add_info_from',result.preProject); // 填充原值
					var preProject = result.preProject;
					if(preProject.fromChannel == '2'){
			    		$("#linkPower").attr("lay-verify","required");
			    		$("#linkPowerDiv").show();
					}else{
						$("#linkPower").removeAttr("lay-verify");
			    		$("#linkPowerDiv").hide();
					}
					var strBuffer = "";
					var sgCoopDiv = $("#sgCoopSelect").clone();
					var coopEffectDiv = $("#coopEffectSelect").clone();
					if(preProject.projectCoopVos.length == 0){
						$('#linkRow1').find('select[name=sgCoopId]').val('');
						$('#linkRow1').find('select[name=coopEffect]').val('');
						$('#delLinkBtn1').hide();
						var rowLength = $("div[id^='linkRow']").length;
						if(rowLength > 1){
							$("div[id^='linkRow']").each(function(){
								var tId = $(this).attr("id").substring(7);
								if(tId != '1'){
									$(this).remove();
								}
							});
						}
						form.render('select');
					}else
					if(preProject.projectCoopVos.length == 1){
						$('#linkRow1').find('select[name=sgCoopId]').val(preProject.projectCoopVos[0].sgCoopId);
						$('#linkRow1').find('select[name=coopEffect]').val(preProject.projectCoopVos[0].coopEffect);
						$('#delLinkBtn1').hide();
						var rowLength = $("div[id^='linkRow']").length;
						if(rowLength > 1){
							$("div[id^='linkRow']").each(function(){
								var tId = $(this).attr("id").substring(7);
								if(tId != '1'){
									$(this).remove();
								}
							});
						}
						form.render('select');
					}else{
						$("div[id^='linkRow']").each(function(){
							var tId = $(this).attr("id").substring(7);
							if(tId != '1'){
								$(this).remove();
							}
						});
						layui.$.each(preProject.projectCoopVos, function(ind,item){
							//第一个需要先赋值
							if(ind == 0){
								$('#linkRow1').find('select[name=sgCoopId]').val(preProject.projectCoopVos[0].sgCoopId);
								$('#linkRow1').find('select[name=coopEffect]').val(preProject.projectCoopVos[0].coopEffect);
								$('#delLinkBtn1').show();
							}else{
								var i = ind + 1;
								strBuffer += '<div class="layui-form-item" id="linkRow'+i+'">';
								strBuffer += '	<div class="layui-inline width106">';
								strBuffer += '		<p class="right">单位<label>'+i+'</label>：</p>';
								strBuffer += '	</div>';
								strBuffer += '	<div class="layui-inline">';
								strBuffer += '		<label class="layui-form-label width60">单位名称</label>';
								strBuffer += '		<div class="layui-input-inline">';
								strBuffer += sgCoopDiv.html();
								strBuffer += '		</div>';
								strBuffer += '	</div>';
								strBuffer += '	<div class="layui-inline">';
						   		strBuffer += '		<label class="layui-form-label">单位作用</label>';
						   		strBuffer += '		<div class="layui-input-inline">';
						   		strBuffer += coopEffectDiv.html();
						   		strBuffer += '		</div>';
						   		strBuffer += '	</div>';
								strBuffer += '	<div class="layui-inline">';
								strBuffer += '		<button type="button" class="layui-btn layui-btn-sm" id="addLinkBtn'+i+'" onclick="addRow(this);"><i class="layui-icon">&#xe654;</i></button>';
								if(i > 1){
									strBuffer += '		<button type="button" class="layui-btn layui-btn-sm" id="delLinkBtn'+i+'" onclick="deleteRow('+i+');"><i class="layui-icon">&#xe640;</i></button>';
								}
								strBuffer += '	</div>';
								strBuffer += '</div>';
								$('#coopDiv').append(strBuffer);
								$('#linkRow'+i).find('select[name=sgCoopId]').val(item.sgCoopId);
								$('#linkRow'+i).find('select[name=coopEffect]').val(item.coopEffect);
								form.render('select');
							}
				        });
					}
					//项目子项页面拼接
					if(preProject.preProjectSubs.length == 1){
						$('#commRow1').find('input[name=subName]').val(preProject.preProjectSubs[0].subName);
						$('#commRow1').find('input[name=subWorkYears]').val(preProject.preProjectSubs[0].workYears);
						$('#commRow1').find('input[name=subBuildYears]').val(preProject.preProjectSubs[0].buildYears);
						$('#commRow1').find('input[name=subOmYears]').val(preProject.preProjectSubs[0].omYears);
						$('#delCommBtn1').hide();
						var rowLength = $("div[id^='commRow']").length;
						if(rowLength > 1){
							$("div[id^='commRow']").each(function(){
								var tId = $(this).attr("id").substring(7);
								if(tId != '1'){
									$(this).remove();
								}
							});
						}
						form.render('select');
					}else{
						$('#subDiv').html('');
						layui.$.each(preProject.preProjectSubs, function(i,item){
							var ind = i + 1;
							var medalHtml = '';
							medalHtml += '<div id="commRow'+ind+'">';
							medalHtml += '	<div class="layui-form-item">';
							medalHtml += '	<div class="layui-inline width106">';
							medalHtml += '		<p class="right">子项<label>'+ind+'</label>：</p>';
							medalHtml += '		<input type="hidden" name="orderIdx" value="'+ind+'"/>';
							medalHtml += '	</div>';
							medalHtml += '	<div class="layui-inline">';
							medalHtml += '		<label class="layui-form-label width60">子项名称</label>';
							medalHtml += '		<div class="layui-input-inline" style="width:120px;">';
							medalHtml += '			<input type="text" name="subName" value="'+item.subName+'" maxlength="100" lay-verify="required" autocomplete="off" class="layui-input">';
							medalHtml += '		</div>';
							medalHtml += '	</div>';
							medalHtml += '	<div class="layui-inline">';
							medalHtml += '		<label class="layui-form-label width98">合作周期（年）</label>';
							medalHtml += '		<div class="layui-input-inline" style="width:98px;">';
							medalHtml += '			<input type="text" name="subWorkYears" value="'+item.workYears+'" maxlength="5" onblur="checkMaxValue(this);" lay-verify="required|number" autocomplete="off" class="layui-input">';
							medalHtml += '		</div>';
							medalHtml += '	</div>';
							medalHtml += '	<div class="layui-inline">';
							medalHtml += '		<label class="layui-form-label width98">建设周期（年）</label>';
							medalHtml += '		<div class="layui-input-inline" style="width:98px;">';
							medalHtml += '			<input type="text" name="subBuildYears" value="'+item.buildYears+'" maxlength="5" onblur="checkMaxValue(this);" lay-verify="required|number" autocomplete="off" class="layui-input">';
							medalHtml += '		</div>';
							medalHtml += '	</div>';
							medalHtml += '	<div class="layui-inline">';
							medalHtml += '		<label class="layui-form-label width98">运营周期（年）</label>';
							medalHtml += '		<div class="layui-input-inline" style="width:98px;">';
							medalHtml += '			<input type="text" name="subOmYears" value="'+item.omYears+'" maxlength="5" onblur="checkMaxValue(this);" lay-verify="required|number" autocomplete="off" class="layui-input">';
							medalHtml += '		</div>';
							medalHtml += '	</div>';
							medalHtml += '	<div class="layui-inline">';
							medalHtml += '		<button type="button" class="layui-btn layui-btn-sm" id="addCommBtn'+ind+'" onclick="addCommRow(this);"><i class="layui-icon">&#xe654;</i></button>';
							medalHtml += '		<button type="button" class="layui-btn layui-btn-sm" id="delCommBtn'+ind+'" onclick="deleteCommRow('+ind+');"><i class="layui-icon">&#xe640;</i></button>';
							medalHtml += '	</div>';
							medalHtml += '	</div>';
							medalHtml += '</div>';
							$('#subDiv').append(medalHtml);
						});
						form.render();
					}

					//获取回报机制复选框
					var backCheckbox = $("input[name=backMech]");
					backCheckbox.each(function(){
						if(preProject.backMech.indexOf($(this).val()) != -1){
			            	$(this).prop('checked', true);
						}else{
			            	$(this).prop('checked', false);
						}
			         	form.render();
			         })
				}else{
					layer.msg('数据通信异常~',{icon: 0});
				}
			}
		});
	});

  	//项目渠道select监听
    form.on('select(add_selectFromChannel)', function(data){
    	var fromChannel = data.value;
    	if(fromChannel == '1'){
    		$("#linkPower").removeAttr("lay-verify");
    		$("#linkPowerDiv").hide();
    	}else{
    		$("#linkPower").attr("lay-verify","required");
    		$("#linkPowerDiv").show();
    	}
	});

   	//监听提交
  	form.on('submit(addInfo_form_submit)', function(data){
  		/*var backMechCount = $('input[name=backMech]:checked').length;
  		if(backMechCount < 1){
  			layer.msg("回报机制至少选中一个",{icon: 0});
  			return;
  		}
  		if(backMechCount > 2){
  			layer.msg("回报机制最多选中两个",{icon: 0});
  			return;
  		}
  		//判断是否上传了立项申请建议书
  		if($("input[name=fileAtt11]").length < 1){
  			layer.msg("立项申请建议书未上传",{icon: 0});
  			return;
  		}
  		//判断是否上传了项目财政承受可行性评估
  		if($("input[name=fileAtt12]").length < 1){
  			layer.msg("项目财政承受可行性评估未上传",{icon: 0});
  			return;
  		}
  		//判断是否上传了项目物有所值评估
  		if($("input[name=fileAtt13]").length < 1){
  			layer.msg("项目物有所值评估未上传",{icon: 0});
  			return;
  		}*/
		var btnId=data.elem.id
		$("#"+btnId).removeAttr("lay-submit").removeClass("layui-bg-blue").addClass("layui-btn-disabled");
		if(btnId=='addInfo_form_submit'){
			$("#submitType").val('2');
		}else{
			$("#submitType").val('1');
		}
		var url='/setupPro/save';
		if(data.field.id&&data.field.id!=''){
			url='/setupPro/edit';
		}
  		//$("#addInfo_form_submit").removeAttr("lay-submit").removeClass("layui-bg-blue").addClass("layui-btn-disabled");
  		layer.load();
       	//提交 Ajax 成功后，静态更新表格中的数据
       	$.ajax({
           	type : 'post',
			url : basePath + url,
           	data: $('#addInfo_form').serialize(),
			success:function(result){
				if(result.success){
					layer.closeAll('loading'); //关闭loading
					layer.msg('提交单据成功~',{icon: 1});
					//两秒后关闭当前页面
					setTimeout(function(){
						/**
						 * 查找父菜单，并刷新
						 */
						var topDoc = $(window.top.document);
						var path = basePath + '/setupPro/list';
						// 获取页面名称
						var name = topDoc.find(".layui-nav-item [lay-href^='" + path + "']").text();
						if(name == '' || name == null){
							name = '立项';
						}
						window.parent.layui.index.openTabsPage(path, name);
						var iframe = window.parent.layui.admin.tabsBody(window.parent.layui.admin.tabsPage.index).find(".layadmin-iframe");
						iframe[0].contentWindow.location.reload(true);

						/**
						 * 关闭当前页
						 */
						var currPath ="";
						if(data.field.id&&data.field.id!=''){
							currPath = basePath + '/setupPro/toDetail?id='+data.field.id;
						}else{
							currPath = basePath + '/setupPro/add';
						}
						var layid = topDoc.find("li[lay-id^='" + currPath + "']").attr('lay-id');
						window.parent.layui.element.tabDelete('layadmin-layout-tabs', layid);//关闭当前页
				        }, 2000);
				}else{
					layer.closeAll('loading'); //关闭loading
  					$("#addInfo_form_submit").removeClass("layui-btn-disabled").addClass("layui-bg-blue").attr("lay-submit","");
					layer.msg(result.msg,{icon: 7});
			  	}
			}
       	});
   	});
 	// data-type事件
    $('.layui-btn.layuiadmin-btn-admin').on('click', function(){
      var type = $(this).data('type');
      active[type] ? active[type].call(this) : '';
    });

  });

	//新增联合体单位
	function addRow(t){
		var $ = layui.$;
		var thisid = $(t).attr("id").substring(10);
		thisid = $("div[id=linkRow" + thisid + "]").find("div:first").find("label").html();
		thisid = parseInt(thisid);
		var nextIndex = parseInt(thisid) + 1;
		var maxInd = $("div[id^='linkRow']").length;
		$("div[id^='linkRow']").each(function(){
			var tId = $(this).attr("id").substring(7);
			tId = parseInt(tId);
		  	if(tId > maxInd){
		  		maxInd = parseInt(tId);
		  	}
		  	var thisIndex = $(this).find("div:first").find("label").html();
		  	thisIndex = parseInt(thisIndex);
		  	var nextId = thisIndex + 1;
		  	if(thisIndex > thisid) {
		  		$("div[id=linkRow" + tId + "]").find("div:first").find("label").html(nextId);
		  	}
		});
		var ind = maxInd + 1;
		var sgCoopDiv = $("#sgCoopSelect").clone();
		var coopEffectDiv = $("#coopEffectSelect").clone();
		var medalHtml = '';
		medalHtml += '<div class="layui-form-item" id="linkRow'+ind+'">';
		medalHtml += '	<div class="layui-inline width106">';
		medalHtml += '		<p class="right">单位<label>'+nextIndex+'</label>：</p>';
		medalHtml += '		<input type="hidden" name="linkShowIndex" value="'+nextIndex+'"/>';
		medalHtml += '	</div>';
		medalHtml += '	<div class="layui-inline">';
		medalHtml += '		<label class="layui-form-label width60">单位名称</label>';
		medalHtml += '		<div class="layui-input-inline">';
   		medalHtml += sgCoopDiv.html();
   		medalHtml += '		</div>';
   		medalHtml += '	</div>';
   		medalHtml += '	<div class="layui-inline">';
   		medalHtml += '		<label class="layui-form-label">单位作用</label>';
   		medalHtml += '		<div class="layui-input-inline">';
   		medalHtml += coopEffectDiv.html();
   		medalHtml += '		</div>';
   		medalHtml += '	</div>';
		medalHtml += '	<div class="layui-inline">';
		medalHtml += '		<button type="button" class="layui-btn layui-btn-sm" id="addLinkBtn'+ind+'" onclick="addRow(this);"><i class="layui-icon">&#xe654;</i></button>';
		medalHtml += '		<button type="button" class="layui-btn layui-btn-sm" id="delLinkBtn'+ind+'" onclick="deleteRow('+ind+');"><i class="layui-icon">&#xe640;</i></button>';
		medalHtml += '	</div>';
		medalHtml += '</div>';
		$(t).parent().parent().after(medalHtml);
		layui.form.render();
	}

	//删除一行
	function deleteRow(id){
		var $ = layui.$;
		layui.layer.confirm('确定删除？',{icon:3, title :'提示'}, function(index){
 		   	var thisid = $("div[id=linkRow" + id + "]").find("div:first").find("label").html();
	    	thisid = parseInt(thisid);
	    	$("div[id^='linkRow']").each(function(){
				var tId = $(this).attr("id").substring(7);
				tId = parseInt(tId);
			  	var thisIndex = $("div[id=linkRow" + tId + "]").find("div:first").find("label").html();
			  	thisIndex = parseInt(thisIndex);
			  	var nextId = thisIndex - 1;
			  	if(thisIndex > thisid) {
			  		$("div[id=linkRow" + tId + "]").find("div:first").find("label").html(nextId);
			  	}
			});
	    	$("#linkRow"+id).remove();
			layui.layer.close(index);
 		});
	}

	//新增子项
	function addCommRow(t){
		var $ = layui.$;
		var delBtnCount = $("button[id^='delCommBtn']").length;
		if(delBtnCount == 1){
			$("button[id^='delCommBtn']").each(function(){
				$(this).removeAttr("style");
			});
		}
		var thisid = $(t).attr("id").substring(10);
		thisid = $("div[id=commRow" + thisid + "]").find(".width106").find("label").html();
		thisid = parseInt(thisid);
		var nextIndex = parseInt(thisid) + 1;
		var maxInd = $("div[id^='commRow']").length;
		$("div[id^='commRow']").each(function(){
			var tId = $(this).attr("id").substring(7);
			tId = parseInt(tId);
		  	if(tId > maxInd){
		  		maxInd = parseInt(tId);
		  	}
		  	var thisIndex = $(this).find(".width106").find("label").html();
		  	thisIndex = parseInt(thisIndex);
		  	var nextId = thisIndex + 1;
		  	if(thisIndex > thisid) {
		  		$("div[id=commRow" + tId + "]").find(".width106").find("label").html(nextId);
		  		$("div[id=commRow" + tId + "]").find(".width106").find("input").val(nextId);
		  	}
		});
		var ind = maxInd + 1;
		var medalHtml = '';
		medalHtml += '<div id="commRow'+ind+'">';
		medalHtml += '	<div class="layui-form-item">';
		medalHtml += '	<div class="layui-inline width106">';
		medalHtml += '		<p class="right">子项<label>'+nextIndex+'</label>：</p>';
		medalHtml += '		<input type="hidden" name="orderIdx" value="'+nextIndex+'"/>';
		medalHtml += '	</div>';
		medalHtml += '	<div class="layui-inline">';
		medalHtml += '		<label class="layui-form-label width60">子项名称</label>';
		medalHtml += '		<div class="layui-input-inline" style="width:120px;">';
		medalHtml += '			<input type="text" name="subName" value="" maxlength="100" lay-verify="required" autocomplete="off" class="layui-input">';
		medalHtml += '		</div>';
		medalHtml += '	</div>';
		medalHtml += '	<div class="layui-inline">';
		medalHtml += '		<label class="layui-form-label width98">合作周期（年）</label>';
		medalHtml += '		<div class="layui-input-inline" style="width:98px;">';
		medalHtml += '			<input type="text" name="subWorkYears" value="" maxlength="5" onblur="checkMaxValue(this);" lay-verify="required|number" autocomplete="off" class="layui-input">';
		medalHtml += '		</div>';
		medalHtml += '	</div>';
		medalHtml += '	<div class="layui-inline">';
		medalHtml += '		<label class="layui-form-label width98">建设周期（年）</label>';
		medalHtml += '		<div class="layui-input-inline" style="width:98px;">';
		medalHtml += '			<input type="text" name="subBuildYears" value="" maxlength="5" onblur="checkMaxValue(this);" lay-verify="required|number" autocomplete="off" class="layui-input">';
		medalHtml += '		</div>';
		medalHtml += '	</div>';
		medalHtml += '	<div class="layui-inline">';
		medalHtml += '		<label class="layui-form-label width98">运营周期（年）</label>';
		medalHtml += '		<div class="layui-input-inline" style="width:98px;">';
		medalHtml += '			<input type="text" name="subOmYears" value="" maxlength="5" onblur="checkMaxValue(this);" lay-verify="required|number" autocomplete="off" class="layui-input">';
		medalHtml += '		</div>';
		medalHtml += '	</div>';
		medalHtml += '	<div class="layui-inline">';
		medalHtml += '		<button type="button" class="layui-btn layui-btn-sm" id="addCommBtn'+ind+'" onclick="addCommRow(this);"><i class="layui-icon">&#xe654;</i></button>';
		medalHtml += '		<button type="button" class="layui-btn layui-btn-sm" id="delCommBtn'+ind+'" onclick="deleteCommRow('+ind+');"><i class="layui-icon">&#xe640;</i></button>';
		medalHtml += '	</div>';
		medalHtml += '	</div>';
		medalHtml += '</div>';
		$(t).parent().parent().parent().after(medalHtml);
		layui.form.render();
	}

	//删除一行
	function deleteCommRow(id){
		var $ = layui.$;
		layui.layer.confirm('确定删除？',{icon:3, title :'提示'}, function(index){
 		    var rowLength = $("div[id^='commRow']").length;
 		   	var thisid = $("div[id=commRow" + id + "]").find(".width106").find("label").html();
	    	thisid = parseInt(thisid);
	    	$("div[id^='commRow']").each(function(){
				var tId = $(this).attr("id").substring(7);
				tId = parseInt(tId);
			  	var thisIndex = $("div[id=commRow" + tId + "]").find(".width106").find("label").html();
			  	thisIndex = parseInt(thisIndex);
			  	var nextId = thisIndex - 1;
			  	if(thisIndex > thisid) {
			  		$("div[id=commRow" + tId + "]").find(".width106").find("label").html(nextId);
			  		$("div[id=commRow" + tId + "]").find(".width106").find("input").val(nextId);
			  	}
			});
	    	$("#commRow"+id).remove();
	    	//剩下最后一行，删除按钮隐藏，input验证关闭
	    	var delBtnCount = $("button[id^='delCommBtn']").length;
			if(delBtnCount == 1){
				$("button[id^='delCommBtn']").each(function(){
					$(this).attr("style","display:none");
				});
			}
			layui.layer.close(index);
 		});
	}

	//删除文件
	function del(index){
		layui.$("#fileAtt_"+index).remove();
		layui.$("#upload_img_"+index).remove();
	}

	//根据url查看文件
	function showImg(url){
		var openWin = window.open(url,'','left=410,height=768, width=1024, top=200,  toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
	}

  	//计算子项最大值
	function checkMaxValue(obj){
  		if(obj.value == '' || obj.value == null){
  			return;
  		}
  		var rgx = /^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;

		var boolrgx = rgx.test(obj.value);// true
		if (!boolrgx) {
			obj.value =0;
			layer.msg('请输入正确数字，且保留两位小数！');
			return;
		}
  		var $ = layui.$;
  		var thisVal = parseFloat(obj.value);
  		var name = $(obj).attr("name");
  		var maxVal = thisVal;
  		if($("input[name="+name+"]").length > 1){
	  		$("input[name="+name+"]").each(function(){
				var tId = $(this).val();
				tId = parseFloat(tId).toFixed(2);
				if(tId > thisVal){
					maxVal = tId;
				}
			});
  		}
  		maxVal = parseFloat(maxVal).toFixed(2);
  		if(name == 'subWorkYears'){
  			$("input[name=workYears]").val(maxVal);
  		}else if(name == 'subBuildYears'){
  			$("input[name=buildYears]").val(maxVal);
  		}else if(name == 'subOmYears'){
  			$("input[name=omYears]").val(maxVal);
  		}
	}

	//计算总投资额、建安工程总费用
	function calcSumAmount(){
		var $ = layui.$;
		var costCae = $("#costCae").val();
		var deviceCost = $("#deviceCost").val();
		var inReadyCost = $("#inReadyCost").val();
		var periodInterest = $("#periodInterest").val();
		var fluidCapital = $("#fluidCapital").val();
		var otherCost = $("#otherCost").val();
		var totalAmount = 0;
		var sumCae = 0;
		var rgx = /^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;

		if(costCae != '' && parseFloat(costCae) >= 0 && rgx.test(costCae)==true){
			totalAmount = parseFloat(totalAmount) + parseFloat(costCae);
			totalAmount = totalAmount.toFixed(2);
			sumCae = totalAmount;
		}else{
			costCae = 0;
			$("#costCae").val(0);
			totalAmount = parseFloat(totalAmount) + parseFloat(costCae);
			totalAmount = totalAmount.toFixed(2);
			sumCae = totalAmount;
			layer.msg('请输入正确数字，且保留两位小数！');
		}
		if(deviceCost != '' && parseFloat(deviceCost) >= 0&& rgx.test(deviceCost)==true){
			totalAmount = parseFloat(totalAmount) + parseFloat(deviceCost);
			totalAmount = totalAmount.toFixed(2);
			sumCae = totalAmount;
		}else{
			deviceCost = 0;
			$("#deviceCost").val(0);
			totalAmount = parseFloat(totalAmount) + parseFloat(deviceCost);
			totalAmount = totalAmount.toFixed(2);
			sumCae = totalAmount;
			layer.msg('请输入正确数字，且保留两位小数！');
		}
		if(inReadyCost != '' && parseFloat(inReadyCost) >= 0&& rgx.test(inReadyCost)==true){
			totalAmount = parseFloat(totalAmount) + parseFloat(inReadyCost);
			totalAmount = totalAmount.toFixed(2);
			sumCae = totalAmount;
		}else{
			inReadyCost = 0;
			$("#inReadyCost").val(0);
			totalAmount = parseFloat(totalAmount) + parseFloat(inReadyCost);
			totalAmount = totalAmount.toFixed(2);
			sumCae = totalAmount;
			layer.msg('请输入正确数字，且保留两位小数！');
		}
		if(periodInterest != '' && parseFloat(periodInterest) >= 0&& rgx.test(periodInterest)==true){
			totalAmount = parseFloat(totalAmount) + parseFloat(periodInterest);
			totalAmount = totalAmount.toFixed(2);
		}else{
			periodInterest = 0;
			$("#periodInterest").val(0);
			totalAmount = parseFloat(totalAmount) + parseFloat(periodInterest);
			totalAmount = totalAmount.toFixed(2);
			layer.msg('请输入正确数字，且保留两位小数！');
		}
		if(fluidCapital != '' && parseFloat(fluidCapital) >= 0&& rgx.test(fluidCapital)==true){
			totalAmount = parseFloat(totalAmount) + parseFloat(fluidCapital);
			totalAmount = totalAmount.toFixed(2);
		}else{
			fluidCapital = 0;
			$("#fluidCapital").val(0);
			totalAmount = parseFloat(totalAmount) + parseFloat(fluidCapital);
			totalAmount = totalAmount.toFixed(2);
			layer.msg('请输入正确数字，且保留两位小数！');
		}
		if(otherCost != '' && parseFloat(otherCost) >= 0&& rgx.test(otherCost)==true){
			totalAmount = parseFloat(totalAmount) + parseFloat(otherCost);
			totalAmount = totalAmount.toFixed(2);
		}else{
			otherCost = 0;
			$("#otherCost").val(0);
			totalAmount = parseFloat(totalAmount) + parseFloat(otherCost);
			totalAmount = totalAmount.toFixed(2);
			layer.msg('请输入正确数字，且保留两位小数！');
		}
		$("#sumAmount").val(totalAmount);
		$("#sumCae").val(sumCae);
	}
	//'请输入正确数字，且保留两位小数！'
	function isNumberAndFloat1(str) {
		var $ = layui.$, form = layui.form
		if (str.value == '' || str.value == null) {
			return;
		}
		var rgx = /^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;

		var boolrgx = rgx.test(str.value);// true
		if (boolrgx) {
			return true;
		} else {
			str.value =0;
			layer.msg('请输入正确数字，且保留两位小数！');
			return false;
		}
	}
  </script>
</body>
</html>

